package my.li.zhcsmanagerfront.controller;

import Vo.Manger;
import land.MangerFeiginInteger;
import message.LoginMessage;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/manger")
public class LoginController {

    private MangerFeiginInteger mangerFeiginInteger;
    @RequestMapping("/login")
    public String doLogin(Manger manger, HttpServletRequest request){
//        boolean b = mangerFeiginInteger.doLogin(manger);
        System.out.println(manger);
        boolean b = true;
        if(b){
            HttpSession session = request.getSession();
            session.setAttribute("user",manger);
            return "main";
        }else {
            request.setAttribute("msg", LoginMessage.loginError);
            return "index";
        }
    }

}
